package com.swa99ylum.pxf.cell.indexer;

import org.apache.poi.xssf.usermodel.XSSFCell;

import com.swa99ylum.pxf.bean.Index;



/**
 * PXF 的 默认索引器
 * 定值索引器：由于明确指定了 目标 columnIndex，所以 triggerBeginning 直接返回的是 true
 * 
	Index indexCF = new Index(6);
	new CellFiller(new FixedCellIndexer(indexCF), new Object[]{"@{id}"})
等同于
	new CellFiller(new FixedCellIndexer(6), new Object[]{"@{id}"})
等同于
	new CellFiller(6, new Object[]{"@{id}"})
 * 
 */
public class FixedCellIndexer extends CellIndexer {
	

	public FixedCellIndexer(int beginIndex) {
		super();
		this.index = new Index(beginIndex);
	}
	
	public FixedCellIndexer(Index index) {
		super();
		this.index = index;
	}

	
	@Override
	public boolean triggerBeginning(XSSFCell cell) {
		
		
		return true;
		
		/**
		 * cell.getColumnIndex() 必然等于 this.getIndexValue()
		 * 
		 * 因为 RowFiller.fill() 中 有如下代码逻辑：
		 * 
		 * cell = row.getCell(cellIndexer.getIndexValue());
		 */
		
	}

}
